/**
 * 基础函数类
 */
var COOKIE_NAME = 'uid';
  
function getCookies(key) {
	var cookiestring = jQuery.cookie(key);
	if(cookiestring) {
	    return cookiestring;
	}
	return '';
}

function setCookies(key, value) {
	jQuery.cookie(key, value);
}

jQuery(document).ready(function(){
	setCookies('uid', '02018');
//	alert(getCookies('uid'));
});

//非空验证
function validNotNull(data){
	return $.trim(data).length==0;
}

//字符长度验证
function validLength(min,max,data){
	return $.trim(data).length<min || $.trim(data).length>max;
}

//正则表达式
function validRegex(pattern,data){
	return !pattern.test(data);
}

function stringToDate(stringDate) {
	return new Date(Date.parse(stringDate));
}

function GetQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
	var r = window.location.search.match(reg);
	if (r!=null) return (r[2]); return null;
}

function realUrl() {
	var url = window.location.search;
	return url.substr(0, url.lastIndexOf('/') + 1) + GetQueryString("p");
}
function getRealUrl(p) {
	var url = window.location.href;
	var t = url.substr(0, url.lastIndexOf('/') + 1) + p;
	return url.substr(0, url.lastIndexOf('/') + 1) + p;
}